home *** CD-ROM | disk | FTP | other *** search
- > I disagree, and believe that it is a good idea to give an error for
- > such redeclarations.
-
- That defeats the explicit purpose of the feature.
-
- > As far as I can tell, you are complaining because it is not possible
- > to do:
- >
- > typedef union
- > {
- > union wait *__uptr;
- > int *__iptr;
- > } __WAIT_STATUS __attribute__ ((__transparent_union__));
- >
- > /* Declaration */
- > extern __pid_t __wait __P ((__WAIT_STATUS __stat_loc));
- >
- > /* Definition */
- > __pid_t
- > __wait (int *__stat_loc)
- > /* GCC complains about differing types in __wait's signature */
- > {
- > /* some expression involving an int *. */
- > return *__stat_loc = 0;
- > }
-
- I don't care about that per se. But it *must* be possible to do:
-
- #include <sys/wait.h>
- pid_t wait(int *);
-
- and it is highly desireable that it work for a prototype using `union wait *'
- too.
-
-
- > Now, I suggest that the above sequence of code is in bad style.
-
- There is no question about that. It really doesn't matter to me what
- machinations are required in the wait.h decls or in the definitions of the
- wait functions.
-
- But redeclarations with prototypes must be allowed; that is the whole point
- of this ridiculous kludge.
-
- > But, that's only half the story (otherwise, there would be no reason
- > to use a transparent union at all). The macros I define are fine for
- > smart implementors of wait, but what about naive users of wait?
- >
- > The transparent_union allows them to do:
- >
- > {
- > union wait wu;
- > int wi;
- > float wf;
- > wait (&wu);
- > wait (&wi);
- > wait (&wf);
- > }
- >
- > causing GCC to warn about typecasts only on the last `wait' call, even
- > though to the naked eye it appears as if at least one of the other two
- > `wait' calls needs a typecast.
- >
- > I believe that this behaviour is exactly the intention of the original
- > `transparent_union' flag, and that allowing different function
- > prototypes is both confusing and unnecessary, and therefore
- > undesirable.
-
- I happen to know, being the original instigator of the functionality that
- became transparent_union. That is only half of the job originally intended.
- The other half is that naive wait users can do:
-
- #include <sys/wait.h>
- ...
- {
- extern pid_t wait(int *);
- int wi;
- float wf;
- wait(&wi);
- wait(&wf);
- }
-
- and the only type error should be the last wait call, just as if the
- original decl were `pid_t wait(int *);'.
-
-